package com.fmsz.physicalheadline.activitys.head;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.support.v4.view.ViewCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.fmsz.physicalheadline.R;
import com.fmsz.physicalheadline.activitys.BaseActivity;
import com.fmsz.physicalheadline.databinding.ActivityDetailBinding;

public class DetailActivity extends AppCompatActivity {

    private String webUrl;
    private ActivityDetailBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_detail);
        Intent intent = getIntent();
        webUrl = intent.getStringExtra("webUrl");
//        binding.loadingImg
        ViewCompat.animate(binding.loadingImg)
                .rotationBy(3600)
                .setDuration(5)
                .start();
        binding.webViewHead.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageFinished(WebView view, String url) {
                binding.loadingTip.setVisibility(View.GONE);
                super.onPageFinished(view, url);
            }
        });
//        WindowManager.LayoutParams lp = getWindow().getAttributes();
//        lp.alpha = 0.7f;
//       getWindow().setAttributes(lp);
        binding.webViewHead.setWebChromeClient(new WebChromeClient());
        if (webUrl != null) {
            binding.webViewHead.loadUrl("http://m.weibo.cn/status/Eq0zRhyHT");
        }
    }
}
